let path = getDataPath()
// 用户ID
let id = getUrlParam("id");
$(function () {
    // 查询历史数据
    $('#search').bind('click', function(){
		let url = path + '/ls172/reportvalue/setValueDate'
        var params = {
            "date": $('#db_Start').datebox('getValue'),
        }
        $.ajax({
            url: url,
            type: "post",
            async: false,
            dataType: "json",
            headers: {
                Accept: "application/json",
                "Content-Type": "application/json"
            },
            data: JSON.stringify(params),
    
            success: function (data) {
                console.log(data);
            },
            error: function (data) {
                console.log("code", data);
            }
        });
    });
    $('#db_Start').datebox({
        onSelect: function (date) {
            console.log(date);
            let year = date.getFullYear();
            let month = date.getMonth() + 1;
            let day = date.getDate();
            let datestr = year + "-" + (month > 9 ? "" : "0") + month + "-" + (day > 9 ? "" : "0") + day;
            InitData(datestr);

        }, onLoadSuccess: function (data) {
        }
    });
    $('#db_Start').datebox('setValue', getCurrDate());
    GetUserRole();
});

//获取用户权限
function GetUserRole() {
    // let thisdata = [];
    // thisdata.push(InitRole(id));
    let USERdata = InitRole(id);
    if (USERdata != null) {
        InitData(getCurrDate());
    }
     else OpenErrmsg("web/errhtml/404.html");
}
function InitData(datestr) {
    let reportPath = getReportPath();
    $('#Frame').attr("src", reportPath + "&date=" + datestr);
}
// 查询历史数据
